package com.woniu.ly.manageassembly.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.ly.model.model.UserOrderDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserOrderDetailMapper extends BaseMapper<UserOrderDetail> {
    @Select("SELECT user_order_detail_id,user_order_detail_price,user_order_id,traveler_id,user_order_detail_status FROM `t_user_order_detail` WHERE user_order_id = #{userOrderId} ")
    List<UserOrderDetail> getUserOrderDetails(int userOrderId);

    @Select("SELECT user_order_detail_id,user_order_detail_price,user_order_id,traveler_id,user_order_detail_status FROM `t_user_order_detail` WHERE user_order_detail_status = #{userOrderDetailStatus} ")
    IPage<UserOrderDetail> getUserOrderDetailStatus(Page<UserOrderDetail> page,@Param("userOrderDetailStatus") String userOrderDetailStatus);

    @Update("UPDATE `t_user_order_detail` SET user_order_detail_status=#{status} WHERE user_order_id=#{userOrderId} AND traveler_id=#{travelerId}")
    void changeUserOrderDetailStatus(@Param("userOrderId") int userOrderId,@Param("travelerId") int travelerId,@Param("status") String status);
}
